// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

import { Grid } from "pathfinding";
import { _decorator, Component, Node,Label } from 'cc';
import { BaseComponent } from "../../../../extensions/cocos-scaffold-3x/assets/ui/base/BaseComponent";
const { ccclass, property } = _decorator;


@ccclass
export default class GpPathGridNode extends BaseComponent {
    @property(Label)
    lb: Label = null
    x: number
    y: number

    grid: Grid
    start() {
        this.lb.string = this.x + "," + this.y
    }

    update(dt) {
        if (this.grid) {
            const node = this.grid.getNodeAt(this.x, this.y)
            if (node) {
                // if (node.walkable) {
                //     this.node.color = Color.GREEN
                // } else {
                //     this.node.color = Color.RED
                // }
            }
        }
    }
}
